﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ReAnimation.Helpers.Common;
using ReAnimation.MVP.Presenters;
using ReAnimation.MVP.ViewInterfaces;

namespace ReAnimation.MVP.Views
{
    public partial class LoginDialog : BaseFormView, ILoginView
    {
        private LoginPresenter _loginPresenter;

        public LoginDialog(LoginPresenter loginPresenter)
        {
            InitializeComponent();
            _loginPresenter = loginPresenter;
            _loginPresenter.View = this;
        }

        private void LoginButtonClick(object sender, EventArgs e)
        {
            Login.Throw(sender, e);
        }

        public void CloseView()
        {
            Close();
        }

        public string Username
        {
            get { return LoginTextBox.Text; }
            set { LoginTextBox.Text = value; }
        }

        public string Password
        {
            get { return PasswordTextBox.Text; }
            set { PasswordTextBox.Text = value; }
        }

        public event EventHandler Login;
    }
}